﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using BLL;

namespace GUI
{
    public partial class TinTuc : System.Web.UI.Page
    {

        private BaiVietDTO bvDTO;
        private BaiVietBLL bvBLL;
        protected void Page_Load(object sender, EventArgs e)
        {
            
                bvBLL = new BaiVietBLL();

                string action = Request.QueryString["action"];
                if (action != null)
                {
                    if (action.Equals("xembaiviet"))
                    {
                        string mabv = Request.QueryString["mabv"];
                        bvDTO = new BaiVietDTO();
                        bvDTO = bvBLL.GetBaiViet(int.Parse(mabv));
                    }
                }
                loadTinTucToDataList();        
           
        }

        public string tieuDe()
        {
            return bvDTO.TieuDe;
        }

        public string noiDung()
        {
            return bvDTO.NoiDung;
        }


        // load tin tức khác lên datalist
        public void loadTinTucToDataList()
        {
            List<BaiVietDTO> lstBV = new List<BaiVietDTO>();
            lstBV = bvBLL.GetListBaiViet();
            DataListTinTucLienQuan.DataSource = lstBV;
            DataListTinTucLienQuan.DataBind();
        }

    }
}